/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cardgame.game.monsters;

import cardgame.game.*;
import cardgame.game.events.*;
import cardgame.game.mana.*;

/**
 *
 * @author Carl
 */
public class Orianna extends MonsterCard{

    public Orianna(){
        description = new Description("Orianna", "I can make the ticking stop.");
        manaTypes = new Mana[]{Mana.GREEN};
        summonCost = new Cost(new ManaAmount(Mana.GREEN, 1), 0, false);
        attackDamage = 1;
        setLifepoints(1);
        setSpells(new Spell[]{new Spell(){{
                description = new Description("Temporary Mana");
                cost = new Cost(new ManaAmount(), 0, true);
            }
            private SimpleManaCard simpleManaCard = new SimpleManaCard_Green();

            @Override
            public void cast(Game game, SpellParameter[] parameters){
                if(game.triggerEvent(new AddManaEvent(owner, simpleManaCard))){
                    game.addEventListener(new EventListener(){

                        @Override
                        public boolean preEvent(Game game, Event receivedEvent){
                            return true;
                        }

                        @Override
                        public void postEvent(Game game, Event receivedEvent){
                            if(receivedEvent instanceof TurnEndEvent){
                                game.triggerEvent(new RemoveManaEvent(simpleManaCard));
                                game.removeEventListener(this);
                            }
                        }
                    });
                }
            }
        }});
    }
}
